package exception;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FinallyDemoZUOYE2 {
    public static void main(String[] args) throws FileNotFoundException {
        System.out.println("开始");
        FileOutputStream fos=null;
        try {
            fos =new FileOutputStream("a/b/qwe.txt");
            fos.write(1);
        } catch (IOException q){
            System.out.println("出现IO异常解决");
        }finally {
            try {
                if (fos!=null) {
                    fos.close();
                }
            } catch (IOException q){
                q.printStackTrace();
                System.out.println("关闭流时出现异常并解决");
            }

        }
        System.out.println("程序解决");
    }
}
